The manipulation pipeline has been released; THIS DEMO PAGE IS NOW DEPRECATED. For current information on the manipulation pipeline, and information about how to execute pick and place tasks using ROS and the PR2 see the pr2_tabletop_manipulation_apps stack page and the pr2_pick_and_place_demos package.
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Install the model database server and data on a new robot or machine
Description: Describes how to install and start the PostgreSQL server on a robot. Does not show how to load the actual database onto this server.Tutorial Level:
Contents
Install the PostgreSQL server
sudo apt-get install postgresql
- installation process sets up data and configuration directories by itself, and tells you where they are. You can write them down, but there is another way of finding out where they are (below)
- Postgres server should start automatically after install process
- ps auxw | grep postgresql shows server is running as well as data and config directories
In the config directory of PostgreSQL you will find two very important files which we'll be using later:
- pg_hba.conf
- postgresql.conf
Create a PostgreSQL server account
General: PostgreSQL accounts are separate from OS accounts. During the installation process, both a PostgreSQL and an OS account will be created, both called postgres. The postgres account is a superuser, meaning it can add other PostgreSQL accounts.
What we need to do next is to login to PostgreSQL using the postgres account in order to create a new account for us to use.
Log in to the PostgreSQL server
Log into PostgreSQL using the postgres account:
- if you have root access
- become root, then su into the postgres OS account
- that's it; if you are logged in to OS as the postgres account you can also log into PostgreSQL as the same account without a password
- start the psql front end, then skip to the next section:
psql
- if you have sudo privileges, but not root access, and can not become the postgres OS account:
- edit pg_hba.conf to allow username posgres to be logged in by anybody without password
- find the lines:
# Database administrative login by UNIX sockets local all postgres ident sameuser
- change "ident sameuser" to "trust". Remember to change back when done!!!
- after modifying pg_hba.conf, have the Postgresql server reload it by issuing a HUP signal:
ps auxw | grep postgresql sudo kill -HUP xxxx
- you should now be able to start the Postgresql front-end (psql) as the superuser postgres:
psql --username postgres
Add a new database user
Once you are logged in as postgres, you can add a user. It is recommended to start by adding a user WITHOUT superuser privileges, but with CREATETOLE and CREATEDB privilages. This is achieved by the following command:
CREATE ROLE willow LOGIN CREATEDB CREATEROLE PASSWORD 'willow';
You can then quit psql (\q).
If you have modified pg_hba.conf to let the postgres user connect without a password, be sure to revert the change.
Allow connections through TCP/IP
- edit pg_hba.conf
- at the end, where the list of authentication methods is, add the following lines. This allows anybody to connect through TCP/IP and access all databases, as long as they supply a right username and password. The password is md5 encrypted
# Anybody through TCP/IP with password host all all 0.0.0.0 0.0.0.0 md5
- if you do not want to enable TCP/IP connections, one alternative is to allow your brand new user to connect from the local machine, WITH a password. Note that this means only code running on the same machine as the server will be able to connect.
# willow user can connect locally with password local all willow md5
- remember that after modifying pg_hba.conf you must have the Postgresql server reload it by issuing a HUP signal.
ps auxw | grep postgresql sudo kill -HUP xxxx
- to check it, try psql again:
psql --username willow --password --dbname postgres
Now you must let the server know it's supposed to accept TCP/IP connections from anybody. Edit the postgresql.conf file and set
listen_addresses = '*'
You will then need to restart the server altogether. The simplest way of doing this is to restart the machine.
PGAdmin3
PGAdmin is a graphical front-end to a database server. To install it use:
sudo apt-get install pgadmin3
The run it using:
pgadmin3
If you have set your server to accept TCP/IP connections, you can run pgadmin3 on any machine that can talk to your server machine over the network (e.g. the robot base station in the ICRA setup). If your server only accepts local connections, you'll have to run pgadmin3 on the same machine on which you just installed the server.